<?php
var_dump($_POST);
$TaskName=$_POST['task_name'];
$TaskContent=$_POST['task_content'];


$dsn = "sqlsrv:Server=localhost;Database=Task";
$db = new PDO($dsn, "sa", "123456");
$sql="insert into Task(TaskName,TaskContent,TaskStatus,TaskCreateTime,TaskUpdateTime)
values('{$TaskName}','{$TaskContent}','1',getdate(),getdate())
";
var_dump($sql
);
$result = $db->exec($sql);
//判断是否正确
if ($result) {
    echo '增加任务成功，前往<a href="task_list.php">列表页</a>';
} else {
    echo '添加失败';
}